package com.tencent.bugly.crashreport.common.info;

import android.content.Context;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.tencent.bugly.proguard.an;
import com.tencent.bugly.proguard.aq;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Locale;
import net.lingala.zip4j.util.InternalZipConstants;

/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class b {
    private static final String[] a = {"/su", "/su/bin/su", "/sbin/su", "/data/local/xbin/su", "/data/local/bin/su", "/data/local/su", "/system/xbin/su", "/system/bin/su", "/system/sd/xbin/su", "/system/bin/failsafe/su", "/system/bin/cufsdosck", "/system/xbin/cufsdosck", "/system/bin/cufsmgr", "/system/xbin/cufsmgr", "/system/bin/cufaevdd", "/system/xbin/cufaevdd", "/system/bin/conbb", "/system/xbin/conbb"};
    private static final String[] b = {"com.ami.duosupdater.ui", "com.ami.launchmetro", "com.ami.syncduosservices", "com.bluestacks.home", "com.bluestacks.windowsfilemanager", "com.bluestacks.settings", "com.bluestacks.bluestackslocationprovider", "com.bluestacks.appsettings", "com.bluestacks.bstfolder", "com.bluestacks.BstCommandProcessor", "com.bluestacks.s2p", "com.bluestacks.setup", "com.kaopu001.tiantianserver", "com.kpzs.helpercenter", "com.kaopu001.tiantianime", "com.android.development_settings", "com.android.development", "com.android.customlocale2", "com.genymotion.superuser", "com.genymotion.clipboardproxy", "com.uc.xxzs.keyboard", "com.uc.xxzs", "com.blue.huang17.agent", "com.blue.huang17.launcher", "com.blue.huang17.ime", "com.microvirt.guide", "com.microvirt.market", "com.microvirt.memuime", "cn.itools.vm.launcher", "cn.itools.vm.proxy", "cn.itools.vm.softkeyboard", "cn.itools.avdmarket", "com.syd.IME", "com.bignox.app.store.hd", "com.bignox.launcher", "com.bignox.app.phone", "com.bignox.app.noxservice", "com.android.noxpush", "com.haimawan.push", "me.haima.helpcenter", "com.windroy.launcher", "com.windroy.superuser", "com.windroy.launcher", "com.windroy.ime", "com.android.flysilkworm", "com.android.emu.inputservice", "com.tiantian.ime", "com.microvirt.launcher", "me.le8.androidassist", "com.vphone.helper", "com.vphone.launcher", "com.duoyi.giftcenter.giftcenter"};
    private static final String[] c = {"/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "/system/lib/libc_malloc_debug_qemu.so", "/sys/qemu_trace", "/system/bin/qemu-props", "/dev/socket/qemud", "/dev/qemu_pipe", "/dev/socket/baseband_genyd", "/dev/socket/genyd"};
    private static String d = null;
    private static String e = null;

    public static String a(Context context) {
        return "null";
    }

    public static String b(Context context) {
        return "null";
    }

    public static String d(Context context) {
        return "null";
    }

    public static String a() {
        try {
            return Build.MODEL;
        } catch (Throwable th) {
            if (an.a(th)) {
                return "fail";
            }
            th.printStackTrace();
            return "fail";
        }
    }

    public static String b() {
        try {
            return Build.VERSION.RELEASE;
        } catch (Throwable th) {
            if (an.a(th)) {
                return "fail";
            }
            th.printStackTrace();
            return "fail";
        }
    }

    public static int c() {
        try {
            return Build.VERSION.SDK_INT;
        } catch (Throwable th) {
            if (an.a(th)) {
                return -1;
            }
            th.printStackTrace();
            return -1;
        }
    }

    public static String c(Context context) {
        String str = "fail";
        if (context == null) {
            return "fail";
        }
        try {
            str = Settings.Secure.getString(context.getContentResolver(), "android_id");
            return str == null ? "null" : str.toLowerCase();
        } catch (Throwable th) {
            if (!an.a(th)) {
                an.a("Failed to get Android ID.", new Object[0]);
            }
            return str;
        }
    }

    public static String e(Context context) {
        String str = "fail";
        if (context == null) {
            return "fail";
        }
        try {
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
            if (telephonyManager != null) {
                str = telephonyManager.getSimSerialNumber();
                return str == null ? "null" : str;
            }
            return "fail";
        } catch (Throwable unused) {
            an.a("Failed to get SIM serial number.", new Object[0]);
            return str;
        }
    }

    public static String d() {
        try {
            return Build.SERIAL;
        } catch (Throwable unused) {
            an.a("Failed to get hardware serial number.", new Object[0]);
            return "fail";
        }
    }

    public static boolean e() {
        try {
            return Environment.getExternalStorageState().equals("mounted");
        } catch (Throwable th) {
            if (an.a(th)) {
                return false;
            }
            th.printStackTrace();
            return false;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:18:0x0050, code lost:
        r0 = java.lang.System.getProperty("os.arch");
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static java.lang.String a(android.content.Context r4, boolean r5) {
        /*
            r0 = 0
            java.lang.String r1 = "fail"
            if (r5 == 0) goto L4e
            java.lang.String r5 = "ro.product.cpu.abilist"
            java.lang.String r5 = com.tencent.bugly.proguard.aq.b(r4, r5)     // Catch: java.lang.Throwable -> L4c
            boolean r2 = com.tencent.bugly.proguard.aq.a(r5)     // Catch: java.lang.Throwable -> L4c
            if (r2 != 0) goto L17
            boolean r2 = r5.equals(r1)     // Catch: java.lang.Throwable -> L4c
            if (r2 == 0) goto L1d
        L17:
            java.lang.String r5 = "ro.product.cpu.abi"
            java.lang.String r5 = com.tencent.bugly.proguard.aq.b(r4, r5)     // Catch: java.lang.Throwable -> L4c
        L1d:
            boolean r4 = com.tencent.bugly.proguard.aq.a(r5)     // Catch: java.lang.Throwable -> L4c
            if (r4 != 0) goto L4e
            boolean r4 = r5.equals(r1)     // Catch: java.lang.Throwable -> L4c
            if (r4 == 0) goto L2a
            goto L4e
        L2a:
            java.lang.Class<com.tencent.bugly.crashreport.common.info.b> r4 = com.tencent.bugly.crashreport.common.info.b.class
            java.lang.StringBuilder r0 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L4c
            r0.<init>()     // Catch: java.lang.Throwable -> L4c
            java.lang.String r2 = "ABI list: "
            r0.append(r2)     // Catch: java.lang.Throwable -> L4c
            r0.append(r5)     // Catch: java.lang.Throwable -> L4c
            java.lang.String r0 = r0.toString()     // Catch: java.lang.Throwable -> L4c
            r2 = 0
            java.lang.Object[] r3 = new java.lang.Object[r2]     // Catch: java.lang.Throwable -> L4c
            com.tencent.bugly.proguard.an.b(r4, r0, r3)     // Catch: java.lang.Throwable -> L4c
            java.lang.String r4 = ","
            java.lang.String[] r4 = r5.split(r4)     // Catch: java.lang.Throwable -> L4c
            r0 = r4[r2]     // Catch: java.lang.Throwable -> L4c
            goto L4e
        L4c:
            r4 = move-exception
            goto L68
        L4e:
            if (r0 != 0) goto L56
            java.lang.String r4 = "os.arch"
            java.lang.String r0 = java.lang.System.getProperty(r4)     // Catch: java.lang.Throwable -> L4c
        L56:
            java.lang.StringBuilder r4 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L4c
            r4.<init>()     // Catch: java.lang.Throwable -> L4c
            java.lang.String r5 = ""
            r4.append(r5)     // Catch: java.lang.Throwable -> L4c
            r4.append(r0)     // Catch: java.lang.Throwable -> L4c
            java.lang.String r4 = r4.toString()     // Catch: java.lang.Throwable -> L4c
            return r4
        L68:
            boolean r5 = com.tencent.bugly.proguard.an.a(r4)
            if (r5 != 0) goto L71
            r4.printStackTrace()
        L71:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.common.info.b.a(android.content.Context, boolean):java.lang.String");
    }

    public static long f() {
        try {
            StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
            return statFs.getBlockCount() * statFs.getBlockSize();
        } catch (Throwable th) {
            if (!an.a(th)) {
                th.printStackTrace();
            }
            return -1L;
        }
    }

    public static long g() {
        try {
            StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
            return statFs.getAvailableBlocks() * statFs.getBlockSize();
        } catch (Throwable th) {
            if (!an.a(th)) {
                th.printStackTrace();
            }
            return -1L;
        }
    }

    public static long h() {
        FileReader fileReader;
        Throwable th;
        BufferedReader bufferedReader;
        try {
            fileReader = new FileReader("/proc/meminfo");
            try {
                bufferedReader = new BufferedReader(fileReader, 2048);
            } catch (Throwable th2) {
                th = th2;
                bufferedReader = null;
            }
        } catch (Throwable th3) {
            fileReader = null;
            th = th3;
            bufferedReader = null;
        }
        try {
            String readLine = bufferedReader.readLine();
            if (readLine == null) {
                try {
                    bufferedReader.close();
                } catch (IOException e2) {
                    if (!an.a(e2)) {
                        e2.printStackTrace();
                    }
                }
                try {
                    fileReader.close();
                } catch (IOException e3) {
                    if (!an.a(e3)) {
                        e3.printStackTrace();
                    }
                }
                return -1L;
            }
            long parseLong = Long.parseLong(readLine.split(":\\s+", 2)[1].toLowerCase().replace("kb", "").trim()) * 1024;
            try {
                bufferedReader.close();
            } catch (IOException e4) {
                if (!an.a(e4)) {
                    e4.printStackTrace();
                }
            }
            try {
                fileReader.close();
            } catch (IOException e5) {
                if (!an.a(e5)) {
                    e5.printStackTrace();
                }
            }
            return parseLong;
        } catch (Throwable th4) {
            th = th4;
            try {
                if (!an.a(th)) {
                    th.printStackTrace();
                }
                if (bufferedReader != null) {
                    try {
                        bufferedReader.close();
                    } catch (IOException e6) {
                        if (!an.a(e6)) {
                            e6.printStackTrace();
                        }
                    }
                }
                if (fileReader != null) {
                    try {
                        fileReader.close();
                        return -2L;
                    } catch (IOException e7) {
                        if (an.a(e7)) {
                            return -2L;
                        }
                        e7.printStackTrace();
                        return -2L;
                    }
                }
                return -2L;
            } catch (Throwable th5) {
                if (bufferedReader != null) {
                    try {
                        bufferedReader.close();
                    } catch (IOException e8) {
                        if (!an.a(e8)) {
                            e8.printStackTrace();
                        }
                    }
                }
                if (fileReader != null) {
                    try {
                        fileReader.close();
                    } catch (IOException e9) {
                        if (!an.a(e9)) {
                            e9.printStackTrace();
                        }
                    }
                }
                throw th5;
            }
        }
    }

    public static long i() {
        BufferedReader bufferedReader;
        FileReader fileReader;
        try {
            fileReader = new FileReader("/proc/meminfo");
            try {
                bufferedReader = new BufferedReader(fileReader, 2048);
            } catch (Throwable th) {
                th = th;
                bufferedReader = null;
            }
        } catch (Throwable th2) {
            th = th2;
            bufferedReader = null;
            fileReader = null;
        }
        try {
            bufferedReader.readLine();
            String readLine = bufferedReader.readLine();
            if (readLine == null) {
                try {
                    bufferedReader.close();
                } catch (IOException e2) {
                    if (!an.a(e2)) {
                        e2.printStackTrace();
                    }
                }
                try {
                    fileReader.close();
                } catch (IOException e3) {
                    if (!an.a(e3)) {
                        e3.printStackTrace();
                    }
                }
                return -1L;
            }
            long parseLong = (Long.parseLong(readLine.split(":\\s+", 2)[1].toLowerCase().replace("kb", "").trim()) * 1024) + 0;
            String readLine2 = bufferedReader.readLine();
            if (readLine2 == null) {
                try {
                    bufferedReader.close();
                } catch (IOException e4) {
                    if (!an.a(e4)) {
                        e4.printStackTrace();
                    }
                }
                try {
                    fileReader.close();
                } catch (IOException e5) {
                    if (!an.a(e5)) {
                        e5.printStackTrace();
                    }
                }
                return -1L;
            }
            long parseLong2 = Long.parseLong(readLine2.split(":\\s+", 2)[1].toLowerCase().replace("kb", "").trim());
            Long.signum(parseLong2);
            long j = parseLong + (parseLong2 * 1024);
            String readLine3 = bufferedReader.readLine();
            if (readLine3 == null) {
                try {
                    bufferedReader.close();
                } catch (IOException e6) {
                    if (!an.a(e6)) {
                        e6.printStackTrace();
                    }
                }
                try {
                    fileReader.close();
                } catch (IOException e7) {
                    if (!an.a(e7)) {
                        e7.printStackTrace();
                    }
                }
                return -1L;
            }
            long parseLong3 = j + (Long.parseLong(readLine3.split(":\\s+", 2)[1].toLowerCase().replace("kb", "").trim()) * 1024);
            try {
                bufferedReader.close();
            } catch (IOException e8) {
                if (!an.a(e8)) {
                    e8.printStackTrace();
                }
            }
            try {
                fileReader.close();
            } catch (IOException e9) {
                if (!an.a(e9)) {
                    e9.printStackTrace();
                }
            }
            return parseLong3;
        } catch (Throwable th3) {
            th = th3;
            try {
                if (!an.a(th)) {
                    th.printStackTrace();
                }
                if (bufferedReader != null) {
                    try {
                        bufferedReader.close();
                    } catch (IOException e10) {
                        if (!an.a(e10)) {
                            e10.printStackTrace();
                        }
                    }
                }
                if (fileReader != null) {
                    try {
                        fileReader.close();
                        return -2L;
                    } catch (IOException e11) {
                        if (an.a(e11)) {
                            return -2L;
                        }
                        e11.printStackTrace();
                        return -2L;
                    }
                }
                return -2L;
            } catch (Throwable th4) {
                if (bufferedReader != null) {
                    try {
                        bufferedReader.close();
                    } catch (IOException e12) {
                        if (!an.a(e12)) {
                            e12.printStackTrace();
                        }
                    }
                }
                if (fileReader != null) {
                    try {
                        fileReader.close();
                    } catch (IOException e13) {
                        if (!an.a(e13)) {
                            e13.printStackTrace();
                        }
                    }
                }
                throw th4;
            }
        }
    }

    public static long j() {
        if (e()) {
            try {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                return statFs.getBlockCount() * statFs.getBlockSize();
            } catch (Throwable th) {
                if (an.a(th)) {
                    return -2L;
                }
                th.printStackTrace();
                return -2L;
            }
        }
        return 0L;
    }

    public static long k() {
        if (e()) {
            try {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                return statFs.getAvailableBlocks() * statFs.getBlockSize();
            } catch (Throwable th) {
                if (an.a(th)) {
                    return -2L;
                }
                th.printStackTrace();
                return -2L;
            }
        }
        return 0L;
    }

    public static String l() {
        try {
            return Locale.getDefault().getCountry();
        } catch (Throwable th) {
            if (!an.a(th)) {
                th.printStackTrace();
            }
            return "fail";
        }
    }

    public static String m() {
        try {
            return Build.BRAND;
        } catch (Throwable th) {
            if (!an.a(th)) {
                th.printStackTrace();
            }
            return "fail";
        }
    }

    public static String f(Context context) {
        TelephonyManager telephonyManager;
        String str;
        try {
            NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
            if (activeNetworkInfo == null) {
                return null;
            }
            if (activeNetworkInfo.getType() != 1) {
                if (activeNetworkInfo.getType() == 0 && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null) {
                    int networkType = telephonyManager.getNetworkType();
                    switch (networkType) {
                        case 1:
                            str = "GPRS";
                            break;
                        case 2:
                            str = "EDGE";
                            break;
                        case 3:
                            str = "UMTS";
                            break;
                        case 4:
                            str = "CDMA";
                            break;
                        case 5:
                            str = "EVDO_0";
                            break;
                        case 6:
                            str = "EVDO_A";
                            break;
                        case 7:
                            str = "1xRTT";
                            break;
                        case 8:
                            str = "HSDPA";
                            break;
                        case 9:
                            str = "HSUPA";
                            break;
                        case 10:
                            str = "HSPA";
                            break;
                        case 11:
                            str = "iDen";
                            break;
                        case 12:
                            str = "EVDO_B";
                            break;
                        case 13:
                            str = "LTE";
                            break;
                        case 14:
                            str = "eHRPD";
                            break;
                        case 15:
                            str = "HSPA+";
                            break;
                        default:
                            str = "MOBILE(" + networkType + ")";
                            break;
                    }
                } else {
                    return "unknown";
                }
            } else {
                str = "WIFI";
            }
            return str;
        } catch (Exception e2) {
            if (an.a(e2)) {
                return "unknown";
            }
            e2.printStackTrace();
            return "unknown";
        }
    }

    public static String g(Context context) {
        String b2 = aq.b(context, "ro.miui.ui.version.name");
        if (!aq.a(b2) && !b2.equals("fail")) {
            return "XiaoMi/MIUI/" + b2;
        }
        String b3 = aq.b(context, "ro.build.version.emui");
        if (!aq.a(b3) && !b3.equals("fail")) {
            return "HuaWei/EMOTION/" + b3;
        }
        String b4 = aq.b(context, "ro.lenovo.series");
        if (!aq.a(b4) && !b4.equals("fail")) {
            String b5 = aq.b(context, "ro.build.version.incremental");
            return "Lenovo/VIBE/" + b5;
        }
        String b6 = aq.b(context, "ro.build.nubia.rom.name");
        if (!aq.a(b6) && !b6.equals("fail")) {
            return "Zte/NUBIA/" + b6 + "_" + aq.b(context, "ro.build.nubia.rom.code");
        }
        String b7 = aq.b(context, "ro.meizu.product.model");
        if (!aq.a(b7) && !b7.equals("fail")) {
            return "Meizu/FLYME/" + aq.b(context, "ro.build.display.id");
        }
        String b8 = aq.b(context, "ro.build.version.opporom");
        if (!aq.a(b8) && !b8.equals("fail")) {
            return "Oppo/COLOROS/" + b8;
        }
        String b9 = aq.b(context, "ro.vivo.os.build.display.id");
        if (!aq.a(b9) && !b9.equals("fail")) {
            return "vivo/FUNTOUCH/" + b9;
        }
        String b10 = aq.b(context, "ro.aa.romver");
        if (!aq.a(b10) && !b10.equals("fail")) {
            return "htc/" + b10 + InternalZipConstants.ZIP_FILE_SEPARATOR + aq.b(context, "ro.build.description");
        }
        String b11 = aq.b(context, "ro.lewa.version");
        if (!aq.a(b11) && !b11.equals("fail")) {
            return "tcl/" + b11 + InternalZipConstants.ZIP_FILE_SEPARATOR + aq.b(context, "ro.build.display.id");
        }
        String b12 = aq.b(context, "ro.gn.gnromvernumber");
        if (!aq.a(b12) && !b12.equals("fail")) {
            return "amigo/" + b12 + InternalZipConstants.ZIP_FILE_SEPARATOR + aq.b(context, "ro.build.display.id");
        }
        String b13 = aq.b(context, "ro.build.tyd.kbstyle_version");
        if (!aq.a(b13) && !b13.equals("fail")) {
            return "dido/" + b13;
        }
        return aq.b(context, "ro.build.fingerprint") + InternalZipConstants.ZIP_FILE_SEPARATOR + aq.b(context, "ro.build.rom.id");
    }

    public static String h(Context context) {
        return aq.b(context, "ro.board.platform");
    }

    public static boolean n() {
        boolean z;
        String[] strArr = a;
        int length = strArr.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                z = false;
                break;
            } else if (new File(strArr[i]).exists()) {
                z = true;
                break;
            } else {
                i++;
            }
        }
        return (Build.TAGS != null && Build.TAGS.contains("test-keys")) || z;
    }

    /* JADX WARN: Removed duplicated region for block: B:43:0x0092 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static java.lang.String o() {
        /*
            java.lang.String r0 = "/sys/block/mmcblk0/device/cid"
            java.lang.String r1 = "/sys/block/mmcblk0/device/name"
            java.lang.String r2 = ","
            java.lang.String r3 = "/sys/block/mmcblk0/device/type"
            r4 = 0
            java.lang.StringBuilder r5 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L8f
            r5.<init>()     // Catch: java.lang.Throwable -> L8f
            java.io.File r6 = new java.io.File     // Catch: java.lang.Throwable -> L8f
            r6.<init>(r3)     // Catch: java.lang.Throwable -> L8f
            boolean r6 = r6.exists()     // Catch: java.lang.Throwable -> L8f
            if (r6 == 0) goto L30
            java.io.BufferedReader r6 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> L8f
            java.io.FileReader r7 = new java.io.FileReader     // Catch: java.lang.Throwable -> L8f
            r7.<init>(r3)     // Catch: java.lang.Throwable -> L8f
            r6.<init>(r7)     // Catch: java.lang.Throwable -> L8f
            java.lang.String r3 = r6.readLine()     // Catch: java.lang.Throwable -> L8d
            if (r3 == 0) goto L2c
            r5.append(r3)     // Catch: java.lang.Throwable -> L8d
        L2c:
            r6.close()     // Catch: java.lang.Throwable -> L8d
            goto L31
        L30:
            r6 = r4
        L31:
            r5.append(r2)     // Catch: java.lang.Throwable -> L8d
            java.io.File r3 = new java.io.File     // Catch: java.lang.Throwable -> L8d
            r3.<init>(r1)     // Catch: java.lang.Throwable -> L8d
            boolean r3 = r3.exists()     // Catch: java.lang.Throwable -> L8d
            if (r3 == 0) goto L56
            java.io.BufferedReader r3 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> L8d
            java.io.FileReader r7 = new java.io.FileReader     // Catch: java.lang.Throwable -> L8d
            r7.<init>(r1)     // Catch: java.lang.Throwable -> L8d
            r3.<init>(r7)     // Catch: java.lang.Throwable -> L8d
            java.lang.String r1 = r3.readLine()     // Catch: java.lang.Throwable -> L8b
            if (r1 == 0) goto L52
            r5.append(r1)     // Catch: java.lang.Throwable -> L8b
        L52:
            r3.close()     // Catch: java.lang.Throwable -> L8b
            goto L57
        L56:
            r3 = r6
        L57:
            r5.append(r2)     // Catch: java.lang.Throwable -> L8b
            java.io.File r1 = new java.io.File     // Catch: java.lang.Throwable -> L8b
            r1.<init>(r0)     // Catch: java.lang.Throwable -> L8b
            boolean r1 = r1.exists()     // Catch: java.lang.Throwable -> L8b
            if (r1 == 0) goto L79
            java.io.BufferedReader r1 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> L8b
            java.io.FileReader r2 = new java.io.FileReader     // Catch: java.lang.Throwable -> L8b
            r2.<init>(r0)     // Catch: java.lang.Throwable -> L8b
            r1.<init>(r2)     // Catch: java.lang.Throwable -> L8b
            java.lang.String r0 = r1.readLine()     // Catch: java.lang.Throwable -> L89
            if (r0 == 0) goto L7a
            r5.append(r0)     // Catch: java.lang.Throwable -> L89
            goto L7a
        L79:
            r1 = r3
        L7a:
            java.lang.String r0 = r5.toString()     // Catch: java.lang.Throwable -> L89
            if (r1 == 0) goto L88
            r1.close()     // Catch: java.io.IOException -> L84
            goto L88
        L84:
            r1 = move-exception
            com.tencent.bugly.proguard.an.a(r1)
        L88:
            return r0
        L89:
            r3 = r1
            goto L90
        L8b:
            goto L90
        L8d:
            r3 = r6
            goto L90
        L8f:
            r3 = r4
        L90:
            if (r3 == 0) goto L9a
            r3.close()     // Catch: java.io.IOException -> L96
            goto L9a
        L96:
            r0 = move-exception
            com.tencent.bugly.proguard.an.a(r0)
        L9a:
            return r4
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.common.info.b.o():java.lang.String");
    }

    public static String i(Context context) {
        StringBuilder sb = new StringBuilder();
        String b2 = aq.b(context, "ro.genymotion.version");
        if (b2 != null) {
            sb.append("ro.genymotion.version");
            sb.append("|");
            sb.append(b2);
            sb.append("\n");
        }
        String b3 = aq.b(context, "androVM.vbox_dpi");
        if (b3 != null) {
            sb.append("androVM.vbox_dpi");
            sb.append("|");
            sb.append(b3);
            sb.append("\n");
        }
        String b4 = aq.b(context, "qemu.sf.fake_camera");
        if (b4 != null) {
            sb.append("qemu.sf.fake_camera");
            sb.append("|");
            sb.append(b4);
        }
        return sb.toString();
    }

    public static String j(Context context) {
        BufferedReader bufferedReader;
        Throwable th;
        String readLine;
        StringBuilder sb = new StringBuilder();
        if (d == null) {
            d = aq.b(context, "ro.secure");
        }
        if (d != null) {
            sb.append("ro.secure");
            sb.append("|");
            sb.append(d);
            sb.append("\n");
        }
        if (e == null) {
            e = aq.b(context, "ro.debuggable");
        }
        if (e != null) {
            sb.append("ro.debuggable");
            sb.append("|");
            sb.append(e);
            sb.append("\n");
        }
        try {
            bufferedReader = new BufferedReader(new FileReader("/proc/self/status"));
            do {
                try {
                    readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                } catch (Throwable th2) {
                    th = th2;
                    try {
                        an.a(th);
                        return sb.toString();
                    } finally {
                        if (bufferedReader != null) {
                            try {
                                bufferedReader.close();
                            } catch (IOException e2) {
                                an.a(e2);
                            }
                        }
                    }
                }
            } while (!readLine.startsWith("TracerPid:"));
            if (readLine != null) {
                String trim = readLine.substring(10).trim();
                sb.append("tracer_pid");
                sb.append("|");
                sb.append(trim);
            }
            String sb2 = sb.toString();
            try {
                bufferedReader.close();
            } catch (IOException e3) {
                an.a(e3);
            }
            return sb2;
        } catch (Throwable th3) {
            bufferedReader = null;
            th = th3;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:36:0x00a9 A[Catch: IOException -> 0x00ad, TRY_LEAVE, TryCatch #1 {IOException -> 0x00ad, blocks: (B:36:0x00a9, B:33:0x00a2), top: B:45:0x000e }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static java.lang.String k(android.content.Context r8) {
        /*
            java.lang.String r8 = "/sys/class/power_supply/battery/capacity"
            java.lang.String r0 = "/sys/class/power_supply/usb/online"
            java.lang.String r1 = "\n"
            java.lang.String r2 = "/sys/class/power_supply/ac/online"
            java.lang.StringBuilder r3 = new java.lang.StringBuilder
            r3.<init>()
            r4 = 0
            java.io.File r5 = new java.io.File     // Catch: java.lang.Throwable -> La6
            r5.<init>(r2)     // Catch: java.lang.Throwable -> La6
            boolean r5 = r5.exists()     // Catch: java.lang.Throwable -> La6
            java.lang.String r6 = "|"
            if (r5 == 0) goto L3f
            java.io.BufferedReader r5 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> La6
            java.io.FileReader r7 = new java.io.FileReader     // Catch: java.lang.Throwable -> La6
            r7.<init>(r2)     // Catch: java.lang.Throwable -> La6
            r5.<init>(r7)     // Catch: java.lang.Throwable -> La6
            java.lang.String r2 = r5.readLine()     // Catch: java.lang.Throwable -> L3c
            if (r2 == 0) goto L37
            java.lang.String r4 = "ac_online"
            r3.append(r4)     // Catch: java.lang.Throwable -> L3c
            r3.append(r6)     // Catch: java.lang.Throwable -> L3c
            r3.append(r2)     // Catch: java.lang.Throwable -> L3c
        L37:
            r5.close()     // Catch: java.lang.Throwable -> L3c
            r4 = r5
            goto L3f
        L3c:
            r4 = r5
            goto La7
        L3f:
            r3.append(r1)     // Catch: java.lang.Throwable -> La6
            java.io.File r2 = new java.io.File     // Catch: java.lang.Throwable -> La6
            r2.<init>(r0)     // Catch: java.lang.Throwable -> La6
            boolean r2 = r2.exists()     // Catch: java.lang.Throwable -> La6
            if (r2 == 0) goto L70
            java.io.BufferedReader r2 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> La6
            java.io.FileReader r5 = new java.io.FileReader     // Catch: java.lang.Throwable -> La6
            r5.<init>(r0)     // Catch: java.lang.Throwable -> La6
            r2.<init>(r5)     // Catch: java.lang.Throwable -> La6
            java.lang.String r0 = r2.readLine()     // Catch: java.lang.Throwable -> L6e
            if (r0 == 0) goto L69
            java.lang.String r4 = "usb_online"
            r3.append(r4)     // Catch: java.lang.Throwable -> L6e
            r3.append(r6)     // Catch: java.lang.Throwable -> L6e
            r3.append(r0)     // Catch: java.lang.Throwable -> L6e
        L69:
            r2.close()     // Catch: java.lang.Throwable -> L6e
            r4 = r2
            goto L70
        L6e:
            r4 = r2
            goto La7
        L70:
            r3.append(r1)     // Catch: java.lang.Throwable -> La6
            java.io.File r0 = new java.io.File     // Catch: java.lang.Throwable -> La6
            r0.<init>(r8)     // Catch: java.lang.Throwable -> La6
            boolean r0 = r0.exists()     // Catch: java.lang.Throwable -> La6
            if (r0 == 0) goto L9f
            java.io.BufferedReader r0 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> La6
            java.io.FileReader r1 = new java.io.FileReader     // Catch: java.lang.Throwable -> La6
            r1.<init>(r8)     // Catch: java.lang.Throwable -> La6
            r0.<init>(r1)     // Catch: java.lang.Throwable -> La6
            java.lang.String r8 = r0.readLine()     // Catch: java.lang.Throwable -> L9d
            if (r8 == 0) goto L99
            java.lang.String r1 = "battery_capacity"
            r3.append(r1)     // Catch: java.lang.Throwable -> L9d
            r3.append(r6)     // Catch: java.lang.Throwable -> L9d
            r3.append(r8)     // Catch: java.lang.Throwable -> L9d
        L99:
            r0.close()     // Catch: java.lang.Throwable -> L9d
            goto La0
        L9d:
            r4 = r0
            goto La7
        L9f:
            r0 = r4
        La0:
            if (r0 == 0) goto Lb1
            r0.close()     // Catch: java.io.IOException -> Lad
            goto Lb1
        La6:
        La7:
            if (r4 == 0) goto Lb1
            r4.close()     // Catch: java.io.IOException -> Lad
            goto Lb1
        Lad:
            r8 = move-exception
            com.tencent.bugly.proguard.an.a(r8)
        Lb1:
            java.lang.String r8 = r3.toString()
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.common.info.b.k(android.content.Context):java.lang.String");
    }

    public static String l(Context context) {
        StringBuilder sb = new StringBuilder();
        String b2 = aq.b(context, "gsm.sim.state");
        if (b2 != null) {
            sb.append("gsm.sim.state");
            sb.append("|");
            sb.append(b2);
        }
        sb.append("\n");
        String b3 = aq.b(context, "gsm.sim.state2");
        if (b3 != null) {
            sb.append("gsm.sim.state2");
            sb.append("|");
            sb.append(b3);
        }
        return sb.toString();
    }

    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:11:0x0030 -> B:34:0x0041). Please submit an issue!!! */
    public static long m(Context context) {
        BufferedReader bufferedReader;
        float f = 0.0f;
        try {
            try {
                bufferedReader = new BufferedReader(new FileReader("/proc/uptime"));
                try {
                    String readLine = bufferedReader.readLine();
                    if (readLine != null) {
                        f = ((float) (System.currentTimeMillis() / 1000)) - Float.parseFloat(readLine.split(" ")[0]);
                    }
                    bufferedReader.close();
                } catch (Throwable unused) {
                    try {
                        an.a("Failed to get boot time of device.", new Object[0]);
                        if (bufferedReader != null) {
                            bufferedReader.close();
                        }
                        return f;
                    } catch (Throwable th) {
                        if (bufferedReader != null) {
                            try {
                                bufferedReader.close();
                            } catch (IOException e2) {
                                an.a(e2);
                            }
                        }
                        throw th;
                    }
                }
            } catch (Throwable unused2) {
                bufferedReader = null;
            }
        } catch (IOException e3) {
            an.a(e3);
        }
        return f;
    }

    public static boolean n(Context context) {
        return (o(context) == null && p() == null) ? false : true;
    }

    public static String o(Context context) {
        PackageManager packageManager = context.getPackageManager();
        ArrayList arrayList = new ArrayList();
        int i = 0;
        while (true) {
            String[] strArr = b;
            if (i >= strArr.length) {
                break;
            }
            try {
                packageManager.getPackageInfo(strArr[i], 1);
                arrayList.add(Integer.valueOf(i));
            } catch (PackageManager.NameNotFoundException unused) {
            }
            i++;
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        return arrayList.toString();
    }

    public static String p() {
        ArrayList arrayList = new ArrayList();
        int i = 0;
        while (true) {
            String[] strArr = c;
            if (i >= strArr.length) {
                break;
            }
            if (i == 0) {
                if (!new File(strArr[i]).exists()) {
                    arrayList.add(Integer.valueOf(i));
                }
            } else if (new File(strArr[i]).exists()) {
                arrayList.add(Integer.valueOf(i));
            }
            i++;
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        return arrayList.toString();
    }

    public static boolean p(Context context) {
        return (((q(context) | r()) | s()) | q()) > 0;
    }

    public static int q() {
        try {
            Method method = Class.forName("android.app.ActivityManagerNative").getMethod("getDefault", new Class[0]);
            method.setAccessible(true);
            return method.invoke(null, new Object[0]).getClass().getName().startsWith("$Proxy") ? 256 : 0;
        } catch (Exception unused) {
            return 256;
        }
    }

    public static int q(Context context) {
        int i;
        PackageManager packageManager = context.getPackageManager();
        try {
            packageManager.getInstallerPackageName("de.robv.android.xposed.installer");
            i = 1;
        } catch (Exception unused) {
            i = 0;
        }
        try {
            packageManager.getInstallerPackageName("com.saurik.substrate");
            return i | 2;
        } catch (Exception unused2) {
            return i;
        }
    }

    public static int r() {
        StackTraceElement[] stackTrace;
        try {
            throw new Exception("detect hook");
        } catch (Exception e2) {
            int i = 0;
            int i2 = 0;
            for (StackTraceElement stackTraceElement : e2.getStackTrace()) {
                if (stackTraceElement.getClassName().equals("de.robv.android.xposed.XposedBridge") && stackTraceElement.getMethodName().equals("main")) {
                    i |= 4;
                }
                if (stackTraceElement.getClassName().equals("de.robv.android.xposed.XposedBridge") && stackTraceElement.getMethodName().equals("handleHookedMethod")) {
                    i |= 8;
                }
                if (stackTraceElement.getClassName().equals("com.saurik.substrate.MS$2") && stackTraceElement.getMethodName().equals("invoked")) {
                    i |= 16;
                }
                if (stackTraceElement.getClassName().equals("com.android.internal.os.ZygoteInit") && (i2 = i2 + 1) == 2) {
                    i |= 32;
                }
            }
            return i;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:60:0x00c0 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static int s() {
        /*
            r0 = 0
            r1 = 0
            java.util.HashSet r2 = new java.util.HashSet     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            r2.<init>()     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.io.BufferedReader r3 = new java.io.BufferedReader     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.io.InputStreamReader r4 = new java.io.InputStreamReader     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.io.FileInputStream r5 = new java.io.FileInputStream     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.lang.StringBuilder r6 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            r6.<init>()     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.lang.String r7 = "/proc/"
            r6.append(r7)     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            int r7 = android.os.Process.myPid()     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            r6.append(r7)     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.lang.String r7 = "/maps"
            r6.append(r7)     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.lang.String r6 = r6.toString()     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            r5.<init>(r6)     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            java.lang.String r6 = "utf-8"
            r4.<init>(r5, r6)     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
            r3.<init>(r4)     // Catch: java.lang.Throwable -> L96 java.io.IOException -> L99 java.io.FileNotFoundException -> La5 java.io.UnsupportedEncodingException -> Lb1
        L33:
            java.lang.String r1 = r3.readLine()     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            if (r1 == 0) goto L5a
            java.lang.String r4 = ".so"
            boolean r4 = r1.endsWith(r4)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            if (r4 != 0) goto L4a
            java.lang.String r4 = ".jar"
            boolean r4 = r1.endsWith(r4)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            if (r4 != 0) goto L4a
            goto L33
        L4a:
            java.lang.String r4 = " "
            int r4 = r1.lastIndexOf(r4)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            int r4 = r4 + 1
            java.lang.String r1 = r1.substring(r4)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            r2.add(r1)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            goto L33
        L5a:
            java.util.Iterator r1 = r2.iterator()     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
        L5e:
            boolean r2 = r1.hasNext()     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            if (r2 == 0) goto L87
            java.lang.Object r2 = r1.next()     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            r4 = r2
            java.lang.String r4 = (java.lang.String) r4     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            java.lang.String r4 = r4.toLowerCase()     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            java.lang.String r5 = "xposed"
            boolean r4 = r4.contains(r5)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            if (r4 == 0) goto L7a
            r0 = r0 | 64
        L7a:
            java.lang.String r2 = (java.lang.String) r2     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            java.lang.String r4 = "com.saurik.substrate"
            boolean r2 = r2.contains(r4)     // Catch: java.io.IOException -> L90 java.io.FileNotFoundException -> L92 java.io.UnsupportedEncodingException -> L94 java.lang.Throwable -> Lbd
            if (r2 == 0) goto L5e
            r0 = r0 | 128(0x80, float:1.794E-43)
            goto L5e
        L87:
            r3.close()     // Catch: java.io.IOException -> L8b
            goto Lbc
        L8b:
            r1 = move-exception
            r1.printStackTrace()
            goto Lbc
        L90:
            r1 = move-exception
            goto L9c
        L92:
            r1 = move-exception
            goto La8
        L94:
            r1 = move-exception
            goto Lb4
        L96:
            r0 = move-exception
            r3 = r1
            goto Lbe
        L99:
            r2 = move-exception
            r3 = r1
            r1 = r2
        L9c:
            r1.printStackTrace()     // Catch: java.lang.Throwable -> Lbd
            if (r3 == 0) goto Lbc
            r3.close()     // Catch: java.io.IOException -> L8b
            goto Lbc
        La5:
            r2 = move-exception
            r3 = r1
            r1 = r2
        La8:
            r1.printStackTrace()     // Catch: java.lang.Throwable -> Lbd
            if (r3 == 0) goto Lbc
            r3.close()     // Catch: java.io.IOException -> L8b
            goto Lbc
        Lb1:
            r2 = move-exception
            r3 = r1
            r1 = r2
        Lb4:
            r1.printStackTrace()     // Catch: java.lang.Throwable -> Lbd
            if (r3 == 0) goto Lbc
            r3.close()     // Catch: java.io.IOException -> L8b
        Lbc:
            return r0
        Lbd:
            r0 = move-exception
        Lbe:
            if (r3 == 0) goto Lc8
            r3.close()     // Catch: java.io.IOException -> Lc4
            goto Lc8
        Lc4:
            r1 = move-exception
            r1.printStackTrace()
        Lc8:
            goto Lca
        Lc9:
            throw r0
        Lca:
            goto Lc9
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.common.info.b.s():int");
    }
}
